<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" href="css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="css/shoutu.css" />
		<title>收徒领钱</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
		<script src="js/ShareSDK.js"></script>
		<script src="js/jquery-3.3.1.min.js"></script>
		<script src="js/toast.js"></script>

		<script src="js/config.js"></script>

		<style>

			#input{
				position: absolute;
				top: 0;
				left: 0;
				opacity: 0;
				z-index: -99;
			}

            @keyframes fadeIn {
                0% {
                    opacity: 0
                }
                100% {
                    opacity: 1
                }
            }

            @-webkit-keyframes fadeIn {
                0% {
                    opacity: 0
                }
                100% {
                    opacity: 1
                }
            }

            @-moz-keyframes fadeIn {
                0% {
                    opacity: 0
                }
                100% {
                    opacity: 1
                }
            }

            @-o-keyframes fadeIn {
                0% {
                    opacity: 0
                }
                100% {
                    opacity: 1
                }
            }

            @-ms-keyframes fadeIn {
                0% {
                    opacity: 0
                }
                100% {
                    opacity: 1
                }
            }

            @keyframes fadeOut {
                0% {
                    opacity: 1
                }
                100% {
                    opacity: 0
                }
            }

            @-webkit-keyframes fadeOut {
                0% {
                    opacity: 1
                }
                100% {
                    opacity: 0
                }
            }

            @-moz-keyframes fadeOut {
                0% {
                    opacity: 1
                }
                100% {
                    opacity: 0
                }
            }

            @-o-keyframes fadeOut {
                0% {
                    opacity: 1
                }
                100% {
                    opacity: 0
                }
            }

            @-ms-keyframes fadeOut {
                0% {
                    opacity: 1
                }
                100% {
                    opacity: 0
                }
            }

            #toast {
                width: 150px;
                height: 150px;
                text-align: center;
                background: rgba(0, 0, 0, 0.7);
                color: #fff;
                font-size: 18px;
                line-height: 150px;
                padding: 10px;
                border-radius: 3px;
                position: fixed;
                left: 0;
                top: 0;
                right:0;
                bottom:0;
                margin:auto;
                z-index: 9999;
            }

            .hide {
                display: none;
            }

            .fadeOut {
                animation: fadeOut .5s;
            }

            .fadeIn {
                animation: fadeIn .5s;
            }

		</style>
	</head>

	<body>
		<!--<header class="mui-bar mui-bar-nav">-->
			<!--<h3 class="mui-title">大钞市·收徒赚钱</h3>-->

		<!--</header>-->
		 
		<div class="head">
			<!--<a href="./index.html" class="back mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>-->
			<div class="font-big">收徒赚钱</div>
			<div class="font-small">每个新徒弟 赚15元起</div>

		</div>

		<div class="ding">

			<div class="auto">
				<img src="./images/avatar.png" alt="" />
			</div>
			<div class="item">
				<span class="top">我的徒弟</span>
				<div>
					<span class="num" id="tudinum"></span>
					<span class="top-small">人</span>
				</div>
			</div>

			<div class="item">
				<span class="top">今日提成</span>
				<div>
					<span class="cod" id="toprice">

					</span>
					<span class="top-small">元</span>
				
				</div>
				

			</div>

			<div class="item">
				<span class="top">累计提成</span>
				<div>
					<span class="cod" id="allprice"></span>
					<span class="top-small">元</span>
				
				</div>
				
			</div>

		</div>
		<textarea id="input"></textarea>
		<div class="container">
			<div class="fuli">
				<div class="phone">
					<img class="hot" src="./images/hot.png" alt="" />
					<div class="tip">
						<div class="logo">
							<img src="./images/logo-apple.png" alt="" />
						</div>
						<div class="desc">
							<div class="tudi">iPhone徒弟</div>
							<div class="task">完成注册任务</div>
						</div>
					</div>
					<div class="percent">
						提成
						<span>10</span>
						%
					</div>
				</div>
				
				<div class="android">
					
					<div class="tip">
						<div class="logo">
							<img src="./images/android.png" alt="" />
						</div>
						<div class="desc">
							<div class="tudi">安卓徒弟</div>
							<div class="task">完成注册任务</div>
						</div>
					</div>
					<div class="percent">
						提成
						<span>10</span>
						%
					</div>
				</div>
				
				
				
			</div>

			<div class="rule">
				<div class="rContent">
					<div class="rTitle">活动规则</div>
					<div class="rItem">
						<div class="text">
							1. 通过您的分享链接、二维码等官方收徒方式下载大钞市助手的新用户，将自动成为您的徒弟；
						</div>

						<div class="text">

								2. 苹果徒弟每完成一个注册任务您可获得 10% 提成；
							

						</div>

						<div class="text">

							3. 安卓徒弟每完成一个注册任务您可获得 10% 提成；

						</div>

						<div class="text">
							4. 师傅或徒弟通过各种等违规手段非法获取收益的，将视情况扣除违规所得并冻结账号；

						</div>

					</div>

				</div>


			</div>
				<div class="now">
					<div>立刻收徒赚钱</div>
				</div>
				
				<!--弹出收徒方式-->
				<div class="tan">
					<div class="meng">
						
						<div class="tTitle">收徒方式</div>
						<div class="close">
							<img src="./images/grey-close.png" />
						</div>
						<div class="btn">
							<div class="btn1">
								<img src="./images/wechat.png" alt="" />
								<div>微信好友</div>
							</div>

							<div class="btn2" data-codehref="">
								<img src="./images/link.png" alt="" />
								<div>链接</div>
							</div>
							
							<div class="btn3">
								<img class="btn3-img" src="./images/twoCode.png" alt="" />
								<div>二维码</div>
							</div>
						</div>
						
						
					</div>
				</div>
				
				
				
				<!--弹出二维码-->
				
				<div class="tan1">
					<div class="meng1">
						
							<div class="code-image">
								<img class="codeImage" src="./images/2.jpg" alt="" />
							</div>
							<!--<div class="tip">
								长按二维码可保存至相册
							</div>-->
							
							<div class="close1">
								<img src="./images/close.png" alt="" />
							</div>
	
						
					</div>
				</div>

			<!--弹出层，引导用户点击右上角-->

			<div class="tan2">

				<div class="meng-img">
					<img src="./images/111.png" alt="" />
				</div>

				<div class="know">
					<img src="./images/11.png" alt="" />
				</div>

			</div>
				
				
				
				
		</div>


		<script src="js/hex_sha1.js"></script>
		<script src="js/share-data.js"></script>
		<script>
			$(function() {
                init();


			})
            var twoCodeHerf="";
			function init() {
				$.ajax({
					url: host + "/buss/user/info",
					type: "get",
					success: function(res) {
						console.log("1111" + JSON.stringify(res));

						if(res.success) {
							var num = 0;
							if(res.data.tudi!==null){
								num = res.data.tudi.length;
							}else{
								num = 0;
							}
							
							var code = res.data.code;
							var twoCode = res.data.twoCode;

							twoCodeHerf = res.data.twoCodeHerf;
                            console.log("tupain 二维码"+twoCodeHerf);

                            $(".btn3-img").attr("src",twoCode);
                            $(".btn2").eq(0).attr("data-codehref",twoCodeHerf);


						}
					},
					error: function() {
						console.log("失败")
					}

				})

			}




			
			//点击二维码
			$(".btn3").eq(0).click(function() {
				$(".tan1").eq(0).css({
					display: "block"
				});
				$(".tan").eq(0).css({
					display: "none"
				});
				
				var imgUrl = $(".btn3-img").attr("src")
				$(".code-image").html("<img src='"+imgUrl+"' />");
			})

			$(".close1").eq(0).click(function() {
				$(".now").eq(0).css({
					display: "block"
				});
				$(".tan1").eq(0).css({
					display: "none"
				});
			})


            //点击链接
            var codeLink='';
            $(".btn2").eq(0).click(function(e){
                e.preventDefault();
                $(".now").eq(0).css({display:"block"});
                $(".tan").eq(0).css({display:"none"});
                 codeLink = $(".btn2").eq(0).attr("data-codehref");
                console.log("点击是的打印"+codeLink);
                copyText(codeLink);

            })

            function copyText(link) {
                var text = link;
                var input = document.getElementById("input");
                input.value = text; // 修改文本框的内容
                input.select(); // 选中文本
                document.execCommand("copy"); // 执行浏览器复制命令
                // 提示框调用
                toast("已复制",1000);
            }
			
			
			//点击立刻收徒赚钱
			
			$(".now").eq(0).click(function(){
				$(".now").eq(0).css({display:"none"});
				$(".tan").eq(0).css({display:"block"});
				
			})
			
			$(".close").eq(0).click(function(){
				$(".now").eq(0).css({display:"block"});
				$(".tan").eq(0).css({display:"none"});
			})



            //点击微信分享


			//初始化SDK
            function initshare(){
                //android的平台配置信息跟ShareSDK.xml一致；
                var weixinConf =
                    {
                        "Id" : "4",
                        "SortId" : "4",
                        "app_id" : "wxd10f23e1ac58af3d",
                        "app_secret" : "19633c7b91e6a605316abbd40bcbbec2",
                        "RedirectUrl" : "http://www.sharesdk.cn",
                        "ShareByAppClient" : "false",
                        "Enable" : "true"
                    };
                //platformConfig平台配置信息可为null，此时用ShareSDK.xml
                var platformConfig = {};
                platformConfig[$sharesdk.PlatformID.wechat] = weixinConf;
                $sharesdk.initSDKAndSetPlatfromConfig("androidv1101", platformConfig);

            }
			//构造分享内容结构
            var params = {
                "text" : "测试的文字",
                "imageUrl" : "http://task.timxu.me/task/views/app/images/logo.png?v=1.0",
                "title" : "测试的标题",
                "titleUrl" : "http://sharesdk.cn",
                "description" : "测试的描述",
                "site" : "ShareSDK",
                "siteUrl" : "http://sharesdk.cn",
                "type" : $sharesdk.ContentType.Text
            };

            $(".btn1").eq(0).click(function(){


                //直接分享

                $sharesdk.shareContent($sharesdk.platformID.wechat, params, function (platform, state, shareInfo, error) {

                    alert("state = " + state + "\nshareInfo = " + shareInfo + "\nerror = " + error);

                });

			//	点击按钮弹出蒙版引导用户点击右上角的三个点分享
                wx.checkJsApi({
                    jsApiList: ['updateAppMessageShareData'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
                    success: function(res) {
                        // 以键值对的形式返回，可用的api值true，不可用为false
                        // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}


                        var $wx_account = wxdata.wx_account, // 自定义数据，见wxShare_data.js
                            $wx_share = wxdata.wx_share;   // 自定义数据  ，见wxShare_data.js
                        console.log("click")
                        console.log($wx_account)
                        //配置微信信息
                        wx.config ({
                            debug : false,    // true:调试时候弹窗
                            appId : $wx_account[0],  // 微信appid
                            timestamp : $wx_account[1], // 时间戳
                            nonceStr : $wx_account[2],  // 随机字符串
                            signature : $wx_account[3], // 签名
                            jsApiList : [
                                // 所有要调用的 API 都要加到这个列表中
                                'updateAppMessageShareData'  //  分享到朋友接口
                            ]
                        });

                        wx.ready (function () {
                            // 微信分享的数据
                            console.log("ready");
                            wx.updateAppMessageShareData({
                                "imgUrl" : $wx_share[0],    // 分享显示的缩略图地址
                                "link" : twoCodeHerf,    // 分享地址
                                //"link" : 'http://task.timxu.me/task/views/app/start-ios.html',    // 分享地址
                                "desc" :  "最近超火，3千万人都在玩，好东西就要与你分享!",   // 分享描述
                                "title" : "我有一个简单的任务给你",   // 分享标题
                                success: function () {
                                    // 设置成功
                                }
                            })
                        });
                        wx.error(function(res){
                            console.log(res);
                            // config信息验证失败会执行error函数，如签名过期导致验证失败，
                            // 具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，
                            //对于SPA可以在这里更新签名。
                            alert("好像出错了！！");
                        });



							console.log(res);
                            $(".now").eq(0).css({display:"none"});
                            $(".tan2").eq(0).css({display:"block"});
                        	$(".tan").eq(0).css({display:"none"});



                        //点击我知道了

                        $(".know").eq(0).click(function(){
                            //	点击按钮弹出蒙版引导用户点击右上角的三个点分享

                            $(".now").eq(0).css({display:"block"});
                            $(".tan2").eq(0).css({display:"none"});
                            $(".tan").eq(0).css({display:"none"});

                        })

                    }
                });

            })
            //今日提成和累计提成
				$.ajax({
					url: host + "/buss/account/log/tudi",
					type: "get",
					success: function(res) {
						console.log(JSON.stringify(res));
						
						if(res.success){
							var toPrice = res.data.toprice;
							var allPrice = res.data.allprice;
							var tudinum = res.data.tudinum;
							$("#toprice").html(toPrice);
							$("#allprice").html(allPrice);
							$("#tudinum").html(tudinum);
						}

					},
					error: function() {
						console.log("请求今日提成失败")
					}

				})


		
			
		</script>
	</body>

</html>